garmin_gpi: fix proximity alerts for large numbers of isolated waypoints
authormaz <blob@p0d.org>
Sat, 15 Aug 2015 11:58:06 +0000 (13:58 +0200)
committerRobert Lipe <robertlipe@gpsbabel.org>
Mon, 17 Aug 2015 03:43:39 +0000 (22:43 -0500)
commit04ede8b276eb1cc1fb54a9e3a064d020ab4c5de4
treef0f67f45c74600d8afc393dcce20272e51b96c0c
parent29b9c6f5a078030c9a29c0ae7c229a30cf101f7e
garmin_gpi: fix proximity alerts for large numbers of isolated waypoints

Large waypoint lists are organized into blocks of at most
WAYPOINTS_PER_BLOCK (128) POIs in generated GPI files for performance
reasons.

It appears that at least on older Garmin Nuvi devices, proximity alerts
often do not work (they do not show up as Custom POIs) and POI lists get
mangled (even to the point of crashing the unit) when there are several
such blocks, particularly with large lists of isolated waypoints.

This problem is the result of wdata_check() which may leave empty
nodes in the tree after sorting waypoints. These nodes show up as empty
blocks in the output file and are not well handled by some devices.

Preventing wdata_compute_size() and wdata_write() from issuing empty
blocks solves the issue.

Fixes: 26840523d411 ("Add support for multiple POI lists to writer code.")
Signed-off-by: maz <blob@p0d.org>
gpsbabel/garmin_gpi.cc